﻿@model MobileSales.Model.Products.Product

@{
    View.Title = Strings.Products + " - " + Strings.Edit;
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>@Strings.Products &nbsp;&raquo;&nbsp; @Strings.Edit</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>

        @Html.HiddenFor(model => model.Id)

        <div class="editor-label">
            @Html.LabelFor(model => model.Sku)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Sku)
            @Html.ValidationMessageFor(model => model.Sku)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Description)
            @Html.ValidationMessageFor(model => model.Description)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Price)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Price)
            @Html.ValidationMessageFor(model => model.Price)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Quantity)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Quantity)
            @Html.ValidationMessageFor(model => model.Quantity)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.MinQuantity)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.MinQuantity)
            @Html.ValidationMessageFor(model => model.MinQuantity)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.OrderQuantity)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.OrderQuantity)
            @Html.ValidationMessageFor(model => model.OrderQuantity)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Spread)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Spread)
            @Html.ValidationMessageFor(model => model.Spread)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Symbol)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Symbol)
            @Html.ValidationMessageFor(model => model.Symbol)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IsMarketingOnlyItem)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IsMarketingOnlyItem)
            @Html.ValidationMessageFor(model => model.IsMarketingOnlyItem)
        </div>
         <div class="editor-label">
            @Html.LabelFor(model => model.TaxId)
        </div>
        <div class="editor-field">
            @Html.TaxSelect("TaxId", Model.TaxId)
        </div> 

         <div class="editor-label">
            @Html.LabelFor(model => model.UnitId)
        </div>
        <div class="editor-field">
            @Html.UnitSelect("UnitId", Model.UnitId)
        </div>
        
         <div class="editor-label">
            @Strings.Categories
        </div>
        <div class="editor-field">
            @Html.CategorySelect("CategoryIds", 
                                  true,
                                  Model.Categories!=null ? Model.Categories.Select(x => x.Id).ToArray() : null, 
                                  Strings.NoneCategory)
        </div>
        <hr />
        @Html.ParamsEditorsFor(MobileSales.Model.Params.ParamType.Product, Model.Params)

        <p>
            <input type="submit" value="@Strings.Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink(Strings.BackToList, "Index", null, new { @class="icon-button prev-icon" })
</div>

